﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yto.Common.Dependency;
using Yto.Common.Linq;

namespace Yto.EF.Linq
{
    public class EfQueryableAsync : IQueryableAsync, ISingleton
    {
        public Task<int> CountAsync<T>(IQueryable<T> query)
        {
            return query.CountAsync();
        }

        public Task<T> FirstOrDefaultAsync<T>(IQueryable<T> query)
        {
            return query.FirstOrDefaultAsync();
        }

        public Task<List<T>> ToListAsync<T>(IQueryable<T> query)
        {
            return query.ToListAsync();
        }
    }
}
